package com.example.rocketmq.demos;

import org.apache.rocketmq.client.consumer.DefaultLitePullConsumer;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.common.message.MessageExt;

import java.util.List;

public class LitePullConsumer {
    public static void main(String[] args) throws MQClientException {
        DefaultLitePullConsumer consumer = new DefaultLitePullConsumer("LitePullConsumer");
        consumer.setNamesrvAddr("192.168.101.141:9876");

        consumer.subscribe("test-topic","*");
        consumer.start();
        while (true){
            List<MessageExt> list = consumer.poll();
            list.forEach(System.out::println);

        }
    }
}
